								
package com.module.device.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import base.util.Page;

import com.module.device.manager.DeviceEntityManager;
import com.module.device.manager.DeviceTypeManager;
import com.module.device.vo.DeviceEntity;
import com.module.device.vo.DeviceType;

public class DeviceTypeService {
	DeviceEntityManager dem = DeviceEntityManager.getInstance();
	public Page list(DeviceType bean, Integer start, Integer limit)
			throws Exception {
		Page page = new Page();
		page.setStart(start);
		page.setLimit(limit);
		//bean.setUserId(LoginSession.getUserid());
		DeviceTypeManager manager = DeviceTypeManager.getInstance();
		page = manager.list(page, bean);
		return page;
	}

	public Map<String,Object> remove(Long id)throws Exception{       
		Map<String,Object> map = new HashMap<String,Object>();
		DeviceTypeManager manager = DeviceTypeManager.getInstance();
		map = manager.delete(id);
		return map;
		
	}	


	public Map<String,Object> save(DeviceType bean)throws Exception{
		//bean.setOrgId(LoginSession.getOrgid());
		Map<String,Object> map = new HashMap<String,Object>();
		DeviceTypeManager manager = DeviceTypeManager.getInstance();
		map = manager.add(bean);
		return map;

	} 
	

	public DeviceType findById(Long id)throws Exception{
		DeviceType bean = new DeviceType();
		DeviceTypeManager manager = DeviceTypeManager.getInstance();
		bean = manager.findById(id);
		return bean;
	}
	
	public List findByDeviceTypeName(String deviceTypeName) throws Exception
	{
		DeviceType bean = new DeviceType();
		DeviceTypeManager manager = DeviceTypeManager.getInstance();
		bean = manager.findByDeviceTypeName(deviceTypeName);
		/*获取设备实体列表*/
		List deviceEntitylist =dem.findByDeviceTypeId(""+bean.getId());
		List DeviceLifecycles = new ArrayList();
		List DeviceListEntitys = new ArrayList();
		for(int i=0;i<deviceEntitylist.size();i++)
		{
			DeviceEntity de = (DeviceEntity) deviceEntitylist.get(i);
			
		}
		
		
		
		
		
		return deviceEntitylist;
		
	}
	
	
	
	
	
	

}
